// 出差计划
var oabtColumns = [{
  id: 'gpro',
  title: '归属项目',
  width: 200,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'ftime',
  title: '计划开始时间',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime',
  title: '计划结束时间',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'address',
  title: '地点',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'oplan',
  title: '工作计划',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'p1',
  title: '火车/汽车',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
}, {
  id: 'p2',
  title: '飞机',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
}, {
  id: 'p3',
  title: '交通费用',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
}, {
  id: 'p4',
  title: '住宿费用',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
},{
  id: 'p5',
  title: '招待费',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
},{
  id: 'p6',
  title: '其他费用',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
},{
  id: 'p7',
  title: '出差补助',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
},{
  id: 'price',
  title: '预测费用总额',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
  // hideType:'lg|md|sm|xs',
},{
  id: 'p8',
  title: '随同人员',
  width: 20,
  type: 'string',
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
},{
  id: 'operation',
  title: '操作',
  width: 130,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick="layer.msg(\'编辑' + record.id + '信息\');"><i class="fa fa-edit"></i>  编辑</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-danger" onclick="del(' + record.id + ');"><i class="fa fa-trash-o"></i>  删除</button>';
    return content;
  }
}];
var oabtOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '出差计划',
  datas: [{
    id: 1,
    gpro: '移动物联网项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '南京',
    oplan: '工作计划测试数据',
    p1: '￥111100.01元',
    p2: '￥111100.01元',
    p3: '￥111100.01元',
    p4: '￥111100.01元',
    p5: '￥111100.01元',
    p6: '￥111100.01元',
    p7: '￥111100.01元',
    price: '￥999,999,999.00元',
    p8: '张三、李四、王五',
  }, ],
  columns: oabtColumns,
  gridContainer: 'oabtContainer',
  toolbarContainer: 'oabtToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var oabtGrid = $.fn.dlshouwen.grid.init(oabtOption);
$(function () {
  oabtGrid.load();
});
//显示出差计划表单
function shoabtmeg() {
  $('.hdoabtmeg').show();
}
// 隐藏出差计划表单
function hdoabtmeg() {
  $('.hdoabtmeg').hide();
}

// 出差申请审批页面-出差计划列表
var oabt1Columns = [{
  id: 'gpro',
  title: '归属项目',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'ftime',
  title: '计划开始时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime',
  title: '计划结束时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'address',
  title: '地点',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'oplan',
  title: '工作计划',
  type: 'string',
  columnClass: 'text-left',
}, ];
var oabt1Option = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '出差计划',
  datas: [{
    id: 1,
    gpro: '移动物联网A项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '南京',
    oplan: '工作计划测试数据',
  }, {
    id: 2,
    gpro: '联通公司云产品B项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '北京',
    oplan: '工作计划测试数据',
  }, ],
  columns: oabt1Columns,
  gridContainer: 'oabt1Container',
  toolbarContainer: 'oabt1ToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var oabt1Grid = $.fn.dlshouwen.grid.init(oabt1Option);
$(function () {
  oabt1Grid.load();
});

// 出差结果填写页面-出差计划与结果列表
var oabt2Columns = [{
  id: 'gpro',
  title: '归属项目',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'ftime',
  title: '计划开始时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime',
  title: '计划结束时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'address',
  title: '地点',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'oplan',
  title: '工作计划',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'ftime1',
  title: '实际开始时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime1',
  title: '实际结束时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'oend',
  title: '工作结果',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'operation',
  title: '操作',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick="shoabtmeg();"><i class="fa fa-edit"></i>  编辑</button>';
    return content;
  }
}];
var oabt2Option = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '出差计划',
  datas: [{
    id: 1,
    gpro: '移动物联网A项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    ftime1: '',
    etime1: '',
    address: '南京',
    oplan: '工作计划测试数据',
    oend: '',
  }, {
    id: 2,
    gpro: '联通公司云产品B项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    ftime1: '',
    etime1: '',
    address: '北京',
    oplan: '工作计划测试数据',
    oend: '',
  }, ],
  columns: oabt2Columns,
  gridContainer: 'oabt2Container',
  toolbarContainer: 'oabt2ToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var oabt2Grid = $.fn.dlshouwen.grid.init(oabt2Option);
$(function () {
  oabt2Grid.load();
});

// 出差结果审批页面-出差计划与结果列表
var oabt3Columns = [{
  id: 'gpro',
  title: '归属项目',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'ftime',
  title: '计划开始时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime',
  title: '计划结束时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'address',
  title: '地点',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'oplan',
  title: '工作计划',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'ftime1',
  title: '实际开始时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime1',
  title: '实际结束时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'oend',
  title: '工作结果',
  type: 'string',
  columnClass: 'text-left',
}, ];
var oabt3Option = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '出差计划',
  datas: [{
    id: 1,
    gpro: '移动物联网A项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '南京',
    oplan: '工作计划测试数据',
    ftime1: '2018/01/02 08:00',
    etime1: '2018/02/01 12:00',
    oend: '已完成计划内容，具体完成情况测试数据',
  }, {
    id: 2,
    gpro: '联通公司云产品B项目',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '北京',
    oplan: '工作计划测试数据',
    ftime1: '2018/01/02 08:00',
    etime1: '2018/02/01 12:00',
    oend: '已完成计划内容，具体完成情况测试数据',
  }, ],
  columns: oabt3Columns,
  gridContainer: 'oabt3Container',
  toolbarContainer: 'oabt3ToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var oabt3Grid = $.fn.dlshouwen.grid.init(oabt3Option);
$(function () {
  oabt3Grid.load();
});


// 报销费用明细
var afrColumns = [{
  id: 'afrCl',
  title: '报销主体公司',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'afrType',
  title: '报销类目',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
},{
  id: 'time1',
  title: '开始日期',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'time2',
  title: '开始日期',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
},{
  id: 'city1',
  title: '开始城市',
  width: 74,
  type: 'string',
  columnClass: 'text-center',
},{
  id: 'city2',
  title: '结束城市',
  width: 74,
  type: 'string',
  columnClass: 'text-center',
},  {
  id: 'afrPic',
  title: '金额',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'afrTime',
  title: '开票日期',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
}, {
  id: 'afrCl',
  title: '开票单位',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
}, {
  id: 'afrNumber',
  title: '原始单据数量',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  hideType:'lg|md|sm|xs',
}, {
  id: 'afrMsg',
  title: '费用报销明细说明',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'operation',
  title: '操作',
  width: 180,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick="addPro(\'' + record.id + '\');"><i class="icon-plus"></i>  项目分摊</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-info" onclick="layer.msg(\'编辑' + record.id + '信息\');"><i class="fa fa-edit"></i>  编辑</button>';
    content += '<br/>';
    content += '<br/>';
    content += '<button class="btn btn-xs btn-primary" data-toggle="modal" href="#myModal" onclick=""><i class="icon-eye-open"></i>  分摊信息</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-danger" onclick="del(' + record.id + ');"><i class="fa fa-trash-o"></i>  删除</button>';
    return content;
  }
}];
var afrOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '报销费用明细',
  datas: [{
    id: 1,
    afrCl: '赛特斯南京分公司',
    afrType: '交通费用',
    time1: '2018-01-02',
    time2: '2018-01-03',
    city1: '南京',
    city2: '北京',
    afrPic: '￥99999.00元',
    afrTime: '2018-01-02',
    afrNumber: '1张',
    afrMsg: '费用报销明细说明测试数据',
  }, ],
  columns: afrColumns,
  gridContainer: 'afrContainer',
  toolbarContainer: 'afrToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var afrGrid = $.fn.dlshouwen.grid.init(afrOption);
$(function () {
  afrGrid.load();
});

//显示出差费用预测表单
function safrinfo() {
  $('.afrinfo').show();
}
// 隐藏出差费用预测表单
function afrinfo() {
  $('.afrinfo').hide();
}

// 添加项目占比表单
function addPro(id) {
  $('.haddpro').show();
};
// 隐藏项目占比表单
function haddpro() {
  $('.haddpro').hide();
}

// 修改项目占比数据
function editPro(id) {
  var af = $('#pro' + id + ' .sh-btn span').html();
  af = af.substring(0, af.length - 1);
  $('#pro' + id + ' .hd-btn input').val(af);
  $('#pro' + id + ' .sh-btn').hide();
  $('#pro' + id + ' .hd-btn').show();
};

//取消修改项目占比操作
function closePro(id) {
  var number = $('#pro' + id + ' .hd-btn input').val();
  if (number < 0 || number == 0) {
    layer.msg('填写有误，请重新填写！');
    return false;
  } else {
    var af = '￥' + number + '元';
    $('#pro' + id + ' .sh-btn span').html(af);
    $('#pro' + id + ' .hd-btn').hide();
    $('#pro' + id + ' .sh-btn').show();
  }
}

//删除项目占比数据
function delPro(id) {
  layer.confirm('确认删除该项目？', {
    btn: ['确认', '取消'] //按钮
  }, function () {
    $('#pro' + id).remove();
    layer.msg('删除成功', {
      icon: 1
    });
  });
}

// 报销申请-报销项目费用
var afr1Columns = [{
  id: 'afrPro',
  title: '归属项目',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
}, {
  id: 'p1',
  title: '火车/汽车',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'p2',
  title: '飞机',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'p3',
  title: '交通费用',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'p4',
  title: '住宿费用',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'p5',
  title: '招待费',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'p6',
  title: '其他费用',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'p7',
  title: '出差补助',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'pall',
  title: '合计',
  type: 'string',
  columnClass: 'text-center',
}, ];
var afr1Option = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '报销费用明细',
  datas: [{
    id: 1,
    afrPro: '项目A测试数据',
    p1: '￥99999.00元',
    p2: '￥99999.00元',
    p3: '￥99999.00元',
    p4: '￥99999.00元',
    p5: '￥99999.00元',
    p6: '￥99999.00元',
    p7: '￥99999.00元',
    pall: '￥99999.00元',
  }, ],
  columns: afr1Columns,
  gridContainer: 'afr1Container',
  toolbarContainer: 'afr1ToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var afr1Grid = $.fn.dlshouwen.grid.init(afr1Option);
$(function () {
  afr1Grid.load();
});


var gridColumns_2_2_3 = [{
    id: 'userName',
    title: '用户姓名',
    type: 'string',
    width: 100,
    columnClass: 'text-center',
    fastQuery: true,
    fastQueryType: 'eq'
  },
  {
    id: 'position',
    title: '岗位名称',
    type: 'string',
    width: 120,
    columnClass: 'text-center',
    fastQuery: true,
    fastQueryType: 'lk'
  },
  {
    id: 'time',
    title: '入职时间',
    type: 'string',
    columnClass: 'text-center',
    fastQuery: true,
    fastQueryType: 'lk'
  },
  {
    id: 'operation',
    title: '操作',
    type: 'string',
    width: 100,
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
      var content = '';
      content += '<button class="btn btn-xs btn-success" onclick="layer.msg(\'选择' + record.userName + '信息\');"><i class="icon-ok"></i>  确认选择</button>';
      return content;
    }
  }
];
var gridOption_2_2_3 = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL: '/grid/demo/datas/ajax',
  exportFileName: '用户列表',
  datas: [{
    userName: '张三',
    position: '总经理',
    time: '2018-01-02 14:80',
  }, {
    userName: '李四',
    position: '总经理',
    time: '2018-01-02 14:80',
  }, {
    userName: '王五',
    position: '总经理',
    time: '2018-01-02 14:80',
  }, {
    userName: '陈六',
    position: '总经理',
    time: '2018-01-02 14:80',
  }, {
    userName: '陈六',
    position: '总经理',
    time: '2018-01-02 14:80',
  }, ],
  columns: gridColumns_2_2_3,
  gridContainer: 'gridContainer_2_2_3',
  toolbarContainer: 'gridToolBarContainer_2_2_3',
  tools: '',
  pageSize: 5,
  pageSizeLimit: [5, 10, 20]
};
var grid_2_2_3 = $.fn.dlshouwen.grid.init(gridOption_2_2_3);
$(function () {
  grid_2_2_3.load();
});

// 获取焦点显示
$(".perName").focus(function () {
  $(".pdmiddle").show();
});


function pdclose() {
  $(".pdmiddle").hide();
};

// 流程图展开效果
$(function () {
  //左侧滑入组件
  $(".second").pageslide({
    direction: "left",
    modal: true
  });
});